package com.adee.nowcoder.huawei;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.util.Scanner;

public class T054 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String s = in.nextLine();
            s = s.replaceAll("[\\{\\[]", "(");
            s = s.replaceAll("[\\}\\]]", ")");
            System.out.println(s);
            ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
            ScriptEngine javaScript = scriptEngineManager.getEngineByName("JavaScript");
            try {
                System.out.println(javaScript.eval(s));
            }catch (Exception e) {

            }
        }
    }
}
